package com.ruoyi.common.utils.sql;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport;
import org.apache.commons.lang3.ObjectUtils;

/**
 * @author cc
 * @ClassName: com.ruoyi.common.utils.sql
 * @date: 2025/8/12 13:55
 * @Description:
 */
public class MyPageUtils {

    public static <T> Page<T> handlePageParam() {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        int pageNum = ObjectUtils.isEmpty(pageDomain.getPageNum()) ? 1 : pageDomain.getPageNum();
        int pageSize = ObjectUtils.isEmpty(pageDomain.getPageSize()) ? 10 : pageDomain.getPageSize();
        return new Page<>(pageNum, pageSize);
    }
}
